package com.example.stock;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class MyDatabaseHelper extends SQLiteOpenHelper {

    public static final String CREATE_ACCOUNT= "create table stock(id integer primary key autoincrement,"
            + "name VARCHAR(18),"+"number integer,"+"buyprice float,"+"buyfee float,"+"sellprice float DEFAULT 0.00,"
            +"sellfee float DEFAULT 0.00,"+"selltax float DEFAULT 0.00,"+"profit float DEFAULT 0.00,"
            +"selldate DATETIME,"+"buydate DATETIME DEFAULT (datetime(CURRENT_TIMESTAMP,'localtime')))";
    private Context mContext ;

    public MyDatabaseHelper(Context context, String name,SQLiteDatabase.CursorFactory factory, int version) {
        super( context, name, factory, version);
        // TODO Auto-generated constructor stub
        mContext= context;
    }


    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_ACCOUNT);
        //Toast.makeText(mContext,CREATE_ACCOUNT,Toast.LENGTH_LONG).show();
        //Toast.makeText(mContext , "数据库创建成功" , Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
